﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using V_League.Public;
using V_League.Business;


namespace QLBD.Pages
{
    /// <summary>
    /// Interaction logic for Home.xaml
    /// </summary>
    public partial class Home : UserControl
    {
        BTC_Business BTC_Bus;
        BTC_Public BTC_Pub;

        public Home()
        {
            InitializeComponent();
            BTC_Pub = new BTC_Public();
            BTC_Bus = new BTC_Business();
        }

        private void btn_dangnhap_Click(object sender, RoutedEventArgs e)
        {
            if (BTC_Bus.checkuser(txtten.Text, pw_matkhau.Password))
            {
                BTC_Pub.Ma_BTC = (txtten.Text).ToUpper();
                Application.Current.Properties["idBTC"] = BTC_Pub.Ma_BTC;
                BTC_Pub = BTC_Bus.GetInfo(BTC_Pub.Ma_BTC);
                if (BTC_Pub.NVu == "Quản Lý CLB")
                    NavigationCommands.GoToPage.Execute("/Pages/ManHinhChinh.xaml", this);
                else //if (BTC_Pub.NVu == "Quản Lý Vòng Đấu")
                    NavigationCommands.GoToPage.Execute("/Pages/ManHinhChinh2.xaml", this);
            }
            else
            {
                MessageBox.Show("Tên đăng nhập không đúng!!!Mời bạn nhập lại","Lỗi");
                txtten.Clear();
                pw_matkhau.Clear();
            }
        }

        private void btn_thoat_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }
    }
}
